<template>
	<view class="detailsBox">
		<product/>
		<view class="detailsCon">
			<view class="title">商品详情</view>
			<view class="content" v-html="details.commodityDetail">
				
			</view>
		</view>
		<view class="bottomBtn">
			<view class="info">
				支付:{{details.unitPrice * buyInfo.quantity}}积分
				<!-- <text class="buz">余额不足，还差120积分</text> -->
			</view>
			<view class="btn" @click="gocofirm">兑换</view>
		</view>
	</view>
</template>

<script>
	import {mapGetters} from "vuex"
	import {getMallDetails} from '@/api/index.js'
	import product from "../components/product.vue"
	export default {
		components:{
			product
		},
		data() {
			return {
				id:''
				
			}
		},
		computed:{
		    ...mapGetters({
		        details:'base/details',
				buyInfo:'base/buyInfo'
		    })
		},
		async onLoad(options){
			if(options && options.id){
				this.id = options.id
				console.log('this.id:',this.id)
			}
			const res = await getMallDetails({id:this.id})
			this.$store.commit('base/set_details',res)
		},
		created() {
			//console.log("details:",this.details)
			this.$store.commit('base/set_init_buyInfo')
			console.log("buyInfo:",this.buyInfo)
		},
		methods: {
			gocofirm(){
				uni.navigateTo({
					url:'/pages/integral/mall/confirm/confirm'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.detailsBox{
		box-sizing: border-box;
		padding: 20rpx;
		font-size: 28rpx;
		
		.detailsCon{
			box-sizing: border-box;
			margin: 20rpx 0 0 0;
			width: 100%;
			border-radius: 20rpx;
			background: #fff;
			overflow: hidden;
			padding: 20rpx;
			.title{
				font-weight: bold;
				font-size: 34rpx;
				text-align: center;
				padding: 20rpx 0 40rpx 0;
			}
			.content{
				line-height: 50rpx;
				font-size: 28rpx;
			}
		}
		.bottomBtn{
			display: flex;
			box-sizing: border-box;
			position: fixed;
			z-index: 1000;
			left: 0;
			bottom: 0;
			width: 100%;
			height: 110rpx;
			background-color: #fff;
			box-shadow: 0 0 10rpx #ddd;
			padding: 0 20rpx;
			.info{
				display: flex;
				flex-flow: column;
				justify-content: center;
				flex: 1;
				font-weight: bold;
				font-size: 30rpx;
				.buz{
					display: block;
					color: #ca0000;
					font-size: 26rpx;
					padding: 10rpx 0 0 0;
				}
			}
			.btn{
				width: 200rpx;
				height: 80rpx;
				line-height: 80rpx;
				background-color: #238de8;
				border-radius: 40rpx;
				text-align: center;
				font-size: 32rpx;
				color: #fff;
				margin: 15rpx 0 0 0;
			}
		}
	}
</style>
